BIT_TST block

Short summary

Name

BIT_TST

→POU type

→function

Category

IEC-block, BitstringEnh

Conform to →IEC-standard

(plus) not defined in IEC-standard

Graphical interface

Available since

  • version 1.20.0 (for Neuron Power Engineer) – initial variant: ANY_BIT for input IN

  • version 1.35.0 (for Neuron Power Engineer) – enhancement: ANY_INT for input IN

Functionality

The block returns the result for the determination of a bit value (as value TRUE or FALSE – or alternatively equivalents for them).

At input IN, enter a value. At input N, enter the bit number (0-based) that should be tested.

Inputs, return value

 

Identifier

→Data type

Description

Inputs:

IN

 BOOLBYTEWORDDWORD or LWORD
(corresponds to →generic data type ANY_BIT
and
USINTUINTUDINTULINTSINTINTDINT or LINT
(corresponds to →generic data type ANY_INT

input value

N

USINT

the bit number (0-based) to test

Return value:

BOOL

 

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

PROGRAM Test
    VAR
        result1, result2 : BOOL;
    END_VAR
    result1 := BIT_TST(IN := DWORD#16#80000003, N := 2);            (* The variable 'result1' evaluates to 'BOOL#0'. *)
    result2 := BIT_TST(IN := LWORD#16#8000000000000003, N := 63);   (* The variable 'result2' evaluates to 'BOOL#1'. *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.